import 'package:flutter/material.dart';

enum MyTextFieldActionType {
  hideAllPanel, //隐藏所有面板
  setTextField, //设置文本
  requestFocus, //失去焦点
}

class RCChatInputTextFieldController extends ChangeNotifier {
  //输入框
  TextEditingController? textEditingController = TextEditingController();
  MyTextFieldActionType? actionType;
  String inputText = "";

  RCChatInputTextFieldController([TextEditingController? controller]) {
    if (textEditingController != null) {
      textEditingController = controller;
    }
  }

  /// text field unfocused and hide all panel
  hideAllPanel() {
    actionType = MyTextFieldActionType.hideAllPanel;
    notifyListeners();
  }

  setTextField(String text) {
    inputText = text;
    actionType = MyTextFieldActionType.setTextField;
    notifyListeners();
  }

  requestFocus() {
    actionType = MyTextFieldActionType.requestFocus;
    notifyListeners();
  }
}
